<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view locale="#{index.currentLocale}">
	<h:head>
		<title><h:outputText value="#{msg['index.title']}" />
		</title>
	</h:head>
	<h:body>
		<h:outputStylesheet library="css" name="style.css" />
		<ui:include src="options.xhtml" />
		<h:form id="display">
			<p:commandButton value="#{msg['index.options']}" onclick="dlg.show()"
				type="button" style="float: right;" />
			<h:panelGrid columns="2">
				<p:inputText id="searchField" value="#{index.searchField}" size="70"
					required="true" />
				<p:commandButton value="#{msg['index.search']}"
					actionListener="#{index.search}" update="display">
				</p:commandButton>
			</h:panelGrid>
			<p:dataTable id="resultsTable" value="#{index.lazyModel}"
				var="searchResult" rows="10" paginator="true" emptyMessage=""
				paginatorPosition="bottom" lazy="true"
				rendered="#{empty index.lazyModel ? false : true}">
				<p:column>
					<h:panelGrid columns="1">
						<h:panelGrid columns="2">
							<h:outputLink value="#{searchResult.url}">
								<h:outputText value="#{searchResult.title}" />
							</h:outputLink>
							<h:outputText value="#{searchResult.category}" />
						</h:panelGrid>
						<h:outputText value="#{searchResult.kwic}" />
					</h:panelGrid>
				</p:column>
			</p:dataTable>
			<p:graphicImage value="/resources/welcome.gif"
				rendered="#{empty index.lazyModel}" styleClass="welcome" />
		</h:form>
		<p:ajaxStatus styleClass="loading">
			<f:facet name="start">
				<p:graphicImage value="/resources/loading.gif" />
			</f:facet>

			<f:facet name="complete">
				<h:outputText value="" />
			</f:facet>
		</p:ajaxStatus>
	</h:body>
</f:view>
</html>